package com.mebius.sys.service.impl;

import org.springframework.stereotype.Service;

import com.mebius.common.service.BaseService;
import com.mebius.common.utils.BeanUtils;
import com.mebius.sys.entity.Permission;
import com.mebius.sys.service.PermissionService;
import com.mebius.sys.web.dto.PermissionDto;

@Service
public class PermissionImpl extends BaseService<Permission> implements PermissionService{

	@Override
	public void add(PermissionDto dto) {
		Permission entity = new Permission() ;
		BeanUtils.copyNotNullProperties(dto, entity) ;
		this.hibernate.add(entity) ;
	}

	@Override
	public void delete(Long id) {
		this.hibernate.delete(Permission.class, id) ;
	}

	@Override
	public PermissionDto get(Long id) {
		PermissionDto dto = new PermissionDto() ;
		Permission entity = this.hibernate.get(Permission.class, id) ;
		BeanUtils.copyNotNullProperties(entity, dto) ;
		return dto;
	}

}
